package com.sky.config;

import com.sky.properties.AliOssProperties;
import com.sky.utils.AliOssUtil;
import com.sky.utils.MyAliUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Data
@Configuration
@Slf4j
@ConditionalOnMissingBean(MyAliUtils.class)
public class OssConfiguration {
    @Bean
    public MyAliUtils aliOssUtil(AliOssProperties properties){
      return new MyAliUtils(
                properties.getEndpoint(),
                properties.getAccessKeyId(),
                properties.getAccessKeySecret(),
                properties.getBucketName()
        );
    }
}
